<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2016/9/26
 * Time: 14:37
 */
header('Content-type:text/html;charset=utf-8');
?>
<html>
<head>
    <title>订货单显示</title>
    <style>
     body {font-size:15px;position: relative;text-align: center;}
     .top{position: relative;font-size: large; width: 50%;height: 20px;background-color: #DADADA ;color:darkgoldenrod;}
        table{*border-collapse:collapse; width :50%;height: auto; position: center;}
      table tr,td {border:solid #DADADA 1px; text-align: center;background-color: #DADADA;}
    </style>
</head>

   <div class="top">订货单显示</div>
<?php
$good =array(
    array('name'=>'主板','price'=>'379','producing'=>'广东','num'=>3),
    array('name'=>'显卡','price'=>'799','producing'=>'广东','num'=>2),
    array('name'=>'硬盘','price'=>'589','producing'=>'广东','num'=>5)
);
$total=0;
$str="<table>";
$str.="<tr><td>商品名称</td><td>价格（元）</td><td>产地</td>";
$str.="<td>数量（件）</td><td>总价（元）</td></tr>";
foreach ($good as $values){
    $str.='<tr>';
    foreach ($values as $v ){
        $str.='<td>'.$v.'</td>';
    }
    $sum=$values['price']*$values['num'];
    $str.='<td>'.$sum.'</td>';
    $str.='</tr>';
    $total+=$sum;
}
$str.="<tr><td>小计：".$total."元</td></tr></table>";
echo  $str;
?>
</html>
